<?php include('php/authenticatephastregex.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
  <head>
    <title>Phastregex. in-silico chip-seq</title>
    <meta http-equiv="Content-Type" content ="text/html; charset=utf-8">
    <link rel="stylesheet" href="phastregexstylejw.css" type="text/css">
    <?php include('php/jasonweirather.php'); ?>
  </head>
  <body>
    <?php include('php/logoline.php'); ?>
    <div id = "annotate_block">
    <?php
      $filename = $_POST["local_file_name"];  # optionally bring in the local file name
      $feature_name = $_POST["feature_name"];
      $table_name = $_POST["table_name"];
      $species = $_POST["species"];  # optionally bring in the species
      $title = $_POST["title"];  # optionally bring in the title    
      ### check to see if it is in the database and completed already.
      $database = 'zebraphish';
      include("php/dbconnect.php");
      #get the info we need.
      echo('<form enctype="multipart/form-data" action="do_annotate.php" method="post">
        ');
         if($filename != NULL) { 
            echo("<input type=\"hidden\" name=\"local_file_name\" value=\"$filename\"/> filename is $filename<br>\n");
         } else {
            echo('Filename generated by server: <input type="text" name="local_file_name"/><br>');
         }
         echo('
               Choose database with features<select id="table_menu" name="table_name">
                 <option value="encode" selected="yes">encode</option>
                 <option value="feature_overlay">other data</option>
               </select><br>
              Annotate only or filter and annotate?<select id="annotate_menu" name="filter">
                 <option value="false" selected="yes">annotate only</option>
                 <option value="true">filter and annotate</option>
               </select><br>
              max_distance_outside_feature (optional, default 0): <input type="text" name="max_distance_outside_feature"/><br>
              max_distance_from_midpoint (optional, unrestricted by default): <input type="text" name="max_distance_from_midpoint"/><br>
          <input type="submit" value="Submit"/>
      
      ');
      echo "<br>Choose one feature from a relevant category below to filter or annotate data<br>user generated features:<br>";
      echo('<div id = "other_features">');
      $query = "SELECT db_id, feature_name, cell_type, replicate_number, species, original_species, note, original_source FROM feature_overlay_info ORDER BY db_id";
      $result = mysql_query($query);
      while($row = mysql_fetch_object($result)) {
        echo '<input type=radio name ="feature_name" value = "'.$row->db_id.'">'.$row->db_id . " " . $row->feature_name . " " . $row->cell_type . " replicate:" . $row->replicate_number . " species:" . $row->species . " note:" . $row->note . "</input><br>\n";
      }
      echo('</div>');
      echo "encode features:<br>";
      echo('<div id = "encode_features">');
      $query = "SELECT db_id, feature_name, cell_type, replicate_number, species, original_species, note, original_source FROM encode_info ORDER BY db_id";
      $result = mysql_query($query);
      while($row = mysql_fetch_object($result)) {
        echo '<input type=radio name ="feature_name" value = "'.$row->db_id.'">'.$row->db_id . " " . $row->feature_name . " " . $row->cell_type . " species:" . $row->species . "</input><br>\n";
      }
      echo('</div></form>');

    ?>
    </div>
    <?php include('php/lastline.php'); ?>
  </body>
</html> 
